put "Type anything you want in this field" into card field "Original Value"
put "The encrypted text will appear here" into card field "Encrypted"
put "The decrypted text will appear here" into card field "Decrypted"
hide card button "Decrypt"
end openCard
-- part 5 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=47 top=127 right=147 bottom=114
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Encrypt
----- HyperTalk script -----
on mouseUp
--a field must Encrypt itself, so send message to field
send "Encrypt" to card field "Original Value"
--enable decrypt button
show card button "Decrypt"
end mouseUp
-- part 6 (button)
-- low flags: 80
-- high flags: A002
-- rect: left=47 top=163 right=183 bottom=114
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Decrypt
----- HyperTalk script -----
on mouseUp
--send message to field to Decrypt itself
send "Decrypt" to card field "Encrypted"
end mouseUp
-- part 7 (button)
-- low flags: 00
-- high flags: 2000
-- rect: left=67 top=188 right=225 bottom=100
-- title width / last selected line: 0
-- icon id / first selected line: 26425 / 26425
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: More
----- HyperTalk script -----
on mouseUp
go to next card
end mouseUp
-- part 8 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=47 top=283 right=303 bottom=114
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Help
----- HyperTalk script -----
on mouseUp
show card field "Info"
end mouseUp
-- part 10 (field)
-- low flags: 00
-- high flags: 6002
-- rect: left=121 top=63 right=132 bottom=440
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: Original Value
----- HyperTalk script -----
on Encrypt
--When this field invokes the Crypt("E") function, it receives
--an encrypted version of its own value. This script places the
--result into the field below.
put crypt("E") into card field "Encrypted"
end Encrypt
-- part 11 (field)
-- low flags: 01
-- high flags: 2002
-- rect: left=121 top=141 right=210 bottom=440
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: Encrypted
----- HyperTalk script -----
on Decrypt
--this handler places the decrypted version of the data into the
--field below.
put crypt("D") into card field "Decrypted"
end Decrypt
-- part 12 (field)
-- low flags: 01
-- high flags: 2002
-- rect: left=121 top=219 right=288 bottom=440
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: Decrypted
-- part 9 (field)
-- low flags: 81
-- high flags: 0002
-- rect: left=40 top=42 right=319 bottom=473
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 4
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: Info
----- HyperTalk script -----
on mouseUp
hide card field "Info"
end mouseUp
-- part contents for card part 9
----- text -----
Simple Data Encryption for HyperCard
by Steve Daly (CIS 76174,1564)
This stack contains an XFCN named 'Crypt', which performs a rudimentary encryption of the contents of a field. Crypt has a single parameter, which should be a D or an E, (for Decrypt or Encrypt). The function should be invoked by the field to be encrypted. See the scripts for background fields one and two for examples of how this works. The messages defined in this script are sent by the app-ropriate buttons.
The global 'CryptPass' contains a password used by Crypt. In this stack, it is set by Hypercard's ASK PASSWORD command. This global should always be set to something before Crypt is invoked.
The encryption routine is not very fancy, but simply provides a basic encryption service. This may provide some peace of mind when you have to take your hard disk in for service.